<template>
  <div class="aroundBox">
    <div class="aroundCon" v-for="item in merch" :key="item.id">
      <div class="a-cover">
        <img :src="`https://ss.lanqb.com/${item.merch.cover}`" alt="" />
      </div>
      <div class="a-text">
        <p class="title">{{ item.merch.title }}</p>
        <div class="info">
          <img :src="`https://ss.lanqb.com/${item.profile.avatar}`" alt="" />
          <p class="nickname">{{ item.profile.nickname }}</p>
        </div>
        <div class="btn-price">
          <p class="price">￥{{ item.merch.sale_rmb_price }}</p>
          <button class="buy">前往购买</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { getCurrentInstance, ref } from "vue";
const { $axios, $request } =
  getCurrentInstance().appContext.config.globalProperties;

let merch = ref();

// 大触周边  https://m.lanqb.com/api/daniu/interview?link=paging&type=merch&limit=12&page=1
$axios(
  `/lanqb/api/daniu/interview?link=paging&type=merch&limit=12&page=1`,
  "GET"
).then(({ data }) => {
  merch.value = data.data;
  console.log(merch.value);
});
</script>

<style lang="less">
* {
  margin: 0;
  padding: 0;
}
.aroundBox {
  height: calc(100vh - 40px - 44px - 45px - 50px);
  overflow-y: scroll;
  width: 100vw;
  padding: 0 12px;
  background-color: #eee;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .aroundCon {
    width: 170px;
    height: 284px;
    background-color: #ffffff;
    border-radius: 5px;
    margin-top: 10px;
    .a-cover {
      img {
        width: 170px;
        height: 170px;
        border-radius: 5px 5px 0 0;
        display: block;
      }
    }
    .a-text {
      width: 170px;
      padding: 10px;
      box-sizing: border-box;
      .title {
        color: #212b34;
        font-size: 13px;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
      }
      .info {
        display: flex;
        margin-top: 10px;
        img {
          width: 17px;
          height: 17px;
          border-radius: 50%;
        }
        .nickname {
          margin-left: 5px;
          font-size: 12px;
          color: #333333;
        }
      }
      .btn-price {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 10px;
        .price {
          font-size: 15px;
          color: #ff7879;
        }
        .buy {
          width: 70px;
          height: 24px;
          border-radius: 10px;
          background-color: #edce8c;
          color: #634b19;
          border: none;
          font-size: 12px;
        }
      }
    }
  }
}
</style>
